package com.zhkj.txg.module.mine.vm

import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.zhkj.lib.base.BaseViewModel
import com.zhkj.lib.http.BaseResponse
import com.zhkj.lib.http.HttpResponse
import com.zhkj.lib.http.ViewModelSubscribeListener
import com.zhkj.lib.utils.AccountManager
import com.zhkj.txg.module.mine.entity.DeleteArticleResponse
import com.zhkj.txg.module.mine.entity.ProblemDetailResponse
import com.zhkj.txg.module.mine.entity.ProblemResponse
import com.zhkj.txg.module.mine.entity.PublishListResponse
import com.zhkj.txg.module.mine.model.MineManager

class ProblemViewModel(application: Application) : BaseViewModel(application) {

    private val manager = MineManager()
    val problemLiveData = MutableLiveData<HttpResponse<ProblemResponse>>()
    val problemDetailLiveData = MutableLiveData<HttpResponse<ProblemDetailResponse>>()


    fun getCommonProblem() {
        val listener = ViewModelSubscribeListener(problemLiveData)
        val commonProblem = manager.getCommonProblem(listener)
        dispose.add(commonProblem)
    }


    fun getProblemDetail(id: String) {
        val listener = ViewModelSubscribeListener(problemDetailLiveData)
        val problemDetail = manager.getProblemDetail(id, listener)
        dispose.add(problemDetail)
    }
}